package com.wunu.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * 身份认证异常
 * @author wunu kin
 * @since 2019-04-12
 */
@ResponseStatus(value = HttpStatus.UNAUTHORIZED, reason = "资源不存在")
public class UnauthorizedException extends RuntimeException {
	private static final long serialVersionUID = -8716100844379461082L;
    public UnauthorizedException(String msg) {
        super(msg);
    }

    public UnauthorizedException() {
        super();
    }
    

	private Integer code;//自定义异常码


	public Integer getCode() {
		return code;
	}


	public void setCode(Integer code) {
		this.code = code;
	}


	public UnauthorizedException(String message, Integer code) {
		super(message);// 父类的构造函数；调用底层的Throwable的构造函数，将参数message赋值到detailMessage (Throwable的属性)
		this.setCode(code);
		this.code = code;//赋值code码
	}
}
